Skip to content

Conversation

andsens
Copy link
Contributor

@andsens andsens commented Mar 18, 2024

This is one of the nice code changes where we can add more capability with the tiniest diff:
redis-go has a UniversalClient which automatically detects which redis client to use (simple, cluster, or sentinel) based on this piece of code.

func NewUniversalClient(opts *UniversalOptions) UniversalClient {
	if opts.MasterName != "" {
		return NewFailoverClient(opts.failover())
	} else if len(opts.Addrs) > 1 {
		return NewClusterClient(opts.cluster())
	}
	return NewClient(opts.simple())
}

Meaning, this PR introduces support for redis sentinel (HA failover) and also obsoletes the special redis_cluster_options setting. I haven't removed it though (legacy support). At some point a deprecation warning might be in order though.

@andsens andsens marked this pull request as draft March 19, 2024 08:42
@andsens
Copy link
Contributor Author

andsens commented Mar 19, 2024

Woops. UniversalOptions only accepts Addrs, not Addr like with the SimpleOptions. I'll update the PR

@andsens andsens force-pushed the ft-redis-sentinel branch from 0dd2cd7 to 1335e41 Compare March 19, 2024 08:50
@andsens
Copy link
Contributor Author

andsens commented Mar 19, 2024

Hmpf, I don't see a way of doing this cleanly while preserving legacy configs. I suggest breaking compatibility and simplifying the entire thing (looks around, ducks).

@andsens andsens marked this pull request as ready for review March 19, 2024 08:55
This implicitly adds support for redis sentinel HA configuration
@andsens andsens force-pushed the ft-redis-sentinel branch from 1335e41 to 1898e49 Compare March 26, 2025 08:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant